# coding:utf-8

from sklearn.decomposition import PCA

data = [[2, 8, 4, 5],
        [6, 3, 0, 8],
        [5, 4, 9, 1]]

# 1.保留到多少维度
transfer = PCA(n_components=2)
trans_data = transfer.fit_transform(data)
print(trans_data)

# 2.保留信息的百分比
transfer = PCA(n_components=0.9)
trans_data = transfer.fit_transform(data)
print(trans_data)
